package com.i360day.invoker;

import com.i360day.invoker.http.InvokerClient;
import com.i360day.invoker.http.Response;
import com.i360day.invoker.request.HttpInvokerRequest;

import java.io.IOException;

/**
 * 默认执行请求
 *
 * @author liju.z
 */
public final class DefaultHttpInvokerClient implements HttpInvokerRequest {

    private final InvokerClient delegate;

    public DefaultHttpInvokerClient(InvokerClient delegate) {
        this.delegate = delegate;
    }

    @Override
    public Response executor(RequestTemplate requestTemplate) throws IOException {
        return delegate.execute(requestTemplate.convertRequest());
    }
}
